package com.atguigu.gmall.feign.search;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.search.Goods;
import com.atguigu.gmall.search.vo.SearchParamVo;
import com.atguigu.gmall.search.vo.SearchResultVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @Author:lyd
 * @Date:2023/8/26 9:35
 * @Version:1.0
 * @Description
 **/
@FeignClient("service-search")
@RequestMapping("/api/inner/search")
public interface SearchFeignClient {

    /**
     * 保存商品在es中
     *
     * @return
     */
    @PostMapping("/save")
    Result save(@RequestBody Goods goods);

    /**
     * 根据id，从es中删除商品
     *
     * @param id
     * @return
     */
    @DeleteMapping("/delete/{id}")
     Result deleteGoods(@PathVariable Long id);

    /**
     *根据传递的请求参数SearchParamVo，从service-search查询页面需要的数据
     * @param paramVo
     * @return
     */
    @PostMapping("/search")
    Result<SearchResultVo> search(@RequestBody SearchParamVo paramVo);

    /**
     * 更新es中的热度分
     * @param skuId 商品id
     * @param score 热度分
     * @return
     */
    @GetMapping("/inchotscore/{skuId}/{score}")
    public Result incrHotScore(@PathVariable Long skuId, @PathVariable Long score);
}
